package com.tx.review.inner;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.function.Consumer;

/**
 * 匿名内部类
 */
public class AnonymousDemo {
    public static void main(String[] args) {
        List<String> list = new ArrayList<>(Arrays.asList("php","java","best","wowowow"));
        //匿名内部类方式
        list.forEach(new Consumer<String>() {
            @Override
            public void accept(String str) {
                if(str.length() > 3){
                    System.out.println(str);
                }
            }
        });
    }
}